In [1]:
%pylab inline
In [2]:
from neuron import h
h.load_file('stdrun.hoc')
h.tstop = 500
In [3]:
cell1 = h.Section(name = 'cell1')
cell1.L = cell1.diam = 10
Rm = 150e3 # 150 MOhms*cm^2
cell1.insert('hh')
cell1.insert('pas')
cell1.gnabar_hh = 0.25
cell1.gl_hh = 1/Rm
cell1.el_hh = h.v_init
# Current injection
stim = h.IClamp(0.5, sec = cell1)
stim.amp = 0.1
stim.dur = 200
stim.delay = 150
Create hoc Vectors to record time and potential
In [4]:
time, voltage1 = h.Vector(), h.Vector()
time.record(h._ref_t)
voltage1.record(cell1(0.5)._ref_v)
Out[4]:
Create a NetCon object to count spikes
In [5]:
mynetcon = h.NetCon( cell1(0.5)._ref_v, None, sec = cell1)
myhocvector = h.Vector()
mynetcon.record(myhocvector)
Out[5]:
In [6]:
h.run()
Out[6]:
Obtain spike times in a vector
In [7]:
np.array(myhocvector) # spike times
Out[7]:
In [8]:
plt.plot(time, voltage1, lw=1)
plt.xlabel('Time (ms)'), plt.ylabel('Voltage (mV)');
In [ ]: